//
//  JSMLeavingHotDetailsCollectionCell.m
//  TakeYouTourTogether
//
//  Created by dllo on 15/12/3.
//  Copyright © 2015年 king. All rights reserved.
//

#import "JSMLeavingHotDetailsCollectionCell.h"

@implementation JSMLeavingHotDetailsCollectionCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backView = [[BaseView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
        [self.contentView addSubview:self.backView];
        
        self.mainImageView = [[BaseImageView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, 200)];
        [self.contentView addSubview:self.mainImageView];
        
        self.mainLabel = [[BaseLabel alloc] init];
        [self.contentView addSubview:self.mainLabel];
        self.mainLabel.font = [UIFont systemFontOfSize:15];
        self.mainLabel.numberOfLines = 0;
        [self.mainLabel sizeToFit];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:15], NSFontAttributeName, nil];
    CGRect rect = [self.mainLabel.text boundingRectWithSize:CGSizeMake(WIDTH - 20, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    self.mainLabel.frame = CGRectMake(10, self.mainImageView.frame.size.height, WIDTH - 20, rect.size.height);
}

@end
